import requests

#这段代码定义了一个函数 ask_url(url)，用于发送 HTTP 请求并获取网页 HTML 内容
def ask_url(url):
    """获取指定URL的HTML内容"""
    headers = {
        "user-agent": (
            "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) "
            "AppleWebKit/537.36 (KHTML, like Gecko) "
            "Chrome/137.0.0.0 Mobile Safari/537.36 Edg/137.0.0.0"
        )
    }

    try:
        response = requests.get(url, headers=headers)
        response.raise_for_status()
        return response.text
    except Exception as e:
        print("请求失败:", e)
        return ""